<template>
	<view class="content">
		<text>{{titile}}</text>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import utils from "../../static/js/utils.js"
	export default {
		data() {
			return {
				 titile:"Hello World"
			}
		},
		onLoad() {
			//获取本地存储的token 获取不到 则跳转到登录界面
			var token = uni.getStorageSync("token")||[];
			if(token.length==0) {
				uni.redirectTo({
					url: '../login/login',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}else{
				var that = this;
				utils.post("user/tokenlogin",{},function(data){
					that.setInfo({
						user:data.user,
						touch:data.touch,
						star:data.star
					});
				});
			}
		},
		methods: {
			...mapMutations(['setInfo']),
		}
	}
</script>

<style>
	.content {
		text-align: center;
		height: 400upx;
	}
    .logo{
        height: 200upx;
        width: 200upx;
        margin-top: 200upx;
    }
	.title {
		font-size: 36upx;
		color: #8f8f94;
	}
</style>
